package com.honey.mybatis.generator.condition.method;

import com.honey.compilation.java.Clazz;
import com.honey.compilation.java.Parameter;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.mybatis.generator.AbstractMethod;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.condition.ConditionConstant;
import com.honey.mybatis.generator.criteria.CriteriaConstant;

/**
 * or 函数
 * @author Administrator
 *
 */
public class Or1Method extends AbstractMethod {
	
	public Or1Method(){
	}
	
	public Or1Method(Clazz clazz, MybatisPlugin belongPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(clazz, belongPlugin, introspectSchema, introspectSchemaColumn);
	}
	
	/** 方法名称 */
	private static final String METHOD_NAME ="or";
	
	/** 方法体 */
	private static final String[] METHOD_BODY =new String[]{

		ConditionConstant.ORED_CRITERIA+".add("+CriteriaConstant.CRITERION_FIELD_NAME+");"
		
	};
	
	/** 参数 */
	private static final Parameter[] PARAMETER= new Parameter[]{
		new Parameter("T",CriteriaConstant.CRITERION_FIELD_NAME)
	};
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getMethodName()
	 */
	@Override
	protected String getMethodName() {
		return METHOD_NAME;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getBody()
	 */
	@Override
	protected String[] getBody() {
		return METHOD_BODY;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getParameter()
	 */
	@Override
	protected Parameter[] getParameter() {
		return PARAMETER;
	}
	
	public static void main(String []args){
		Or1Method  cm = new Or1Method();
		System.out.println(cm.createMethod().compiledContent(0)); 
	}
}
